%MY_SOBELEDGE Summary of this function goes here
% This method is implemented as described by the class slides
% We choose two standard kernels, one for a vertical filter and the other
% for a horizontal.
% We apply those two kernels to the grayscale image separately, and combine
% them later by taking its magnitude - square root of the sum of the
% squares
function [ G, Gx, Gy ] = my_sobelEdge( img )

%Both kernels as noted on class slides
kernel_x = [1 0 -1; 2 0 -2; 1 0 -1];
kernel_y = [1 2 1; 0 0 0; -1 -2 -1];

% Apply the kernel to the grayscaled image
%img_gray = rgb2gray(double(img)/255);
img_gray = img;

Gx = conv2(img_gray, kernel_x);
Gy = conv2(img_gray, kernel_y);

%Combined gradient magnitude
G = sqrt(Gx.^2 + Gy.^2);

end

